#!/bin/sh
# Copyright (C) 2000 by Massimiliano Ghilardi
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
#

# TOP_SRCDIR
T="$1"

# TOP_BUILDDIR
B="$1"

. "$T"conf/conf.default
if [ -f "$B"conf/conf.current ]; then
   . "$B"conf/conf.current
   if [ -f "$B"conf/conf.auto -a "$B"conf/conf.auto -nt "$B"conf/conf.current ]; then
      . "$B"conf/conf.auto
      echo "# Using configuration generated by './configure' saved in conf.auto"
   else
      echo "# Using manual configuration saved in conf.current"
   fi
elif [ -f "$B"conf/conf.auto ]; then
   . "$B"conf/conf.auto
   echo "# Using configuration generated by './configure' saved in conf.auto"
else
   echo "# Using default configuration from conf.default"
fi

cat >"$B"conf/conf.current <<EOF
#
# This file holds the current configuration.
# It was created by 'make config', do not edit!
#
# Configuration:
#
EOF

for i in `cat "$T"conf/conf.list`; do 
    eval "echo $i=\${$i}"
done >>"$B"conf/conf.current

